package cn.wetcland.urban.framework.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.wetcland.urban.common.AjaxResponse;
import cn.wetcland.urban.common.MyAssert;
import cn.wetcland.urban.framework.service.UtArticleService;
import cn.wetcland.urban.generator.domain.UtArticle;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @Resource
    public UtArticleService articleService;

    @GetMapping("/get/{id}")
    public AjaxResponse getArticle(@PathVariable Long id) {
        UtArticle byId = articleService.getById(id);
        MyAssert.notNull(byId, "文章不存在");
        return AjaxResponse.success(byId);
    }

}
